import { createApp } from 'vue';
import App from './App.vue';
import { setupI18n } from './locales';
import { setupAssets, setupScrollbarStyle } from './plugins';
import { setupStore } from './store';
import { setupRouter } from './router';
import 'virtual:svg-icons-register'; // 引入虚拟的 svg 图标模块
import IconSvg from '@/components/common/IconSvg/index.vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import * as ElIcons from '@element-plus/icons-vue';
import 'vue3-emoji-picker/css';

async function bootstrap() {
  const app = createApp(App);
  Object.keys(ElIcons).forEach((key) => {
    app.component(key, ElIcons[key as keyof typeof ElIcons]);
  });
  // 全局注册 SvgIcon 组件
  app.component('IconSvg', IconSvg);
  app.use(ElementPlus);
  setupAssets();

  setupScrollbarStyle();
  setupStore(app);
  setupI18n(app);

  await setupRouter(app);

  app.mount('#app');
}

bootstrap();
